import { del, get, post, put } from "@/utils/request";
import {
  type clothesAddParams,
  type clothesListData,
  type clothesListParams,
  type clothesListReturn,
} from "./type";

// 洗衣错衣列表
export const clothesList = (data: clothesListParams) => {
  return get<clothesListParams, clothesListReturn>("/api/clothes/list", data);
};

// 洗衣错衣添加
export const clothesAdd = (data: clothesAddParams) => {
  return post<clothesAddParams, clothesListData>("/api/clothes/add", data);
};

// 洗衣错衣添加
export const clothesUpdate = (data: clothesAddParams) => {
  return put<clothesAddParams, clothesListData>("/api/clothes/update", data);
};

// 获取单条数据
export const clothesGet = (id: number) => {
  return get<number, clothesListData>(`/api/clothes/get/${id}`);
};

// 删除
export const clothesDel = (id: number) => {
  return del<null, null>(`/api/clothes/delete/${id}`);
};

// 批删
export const clothesDelAll = (data: number[]) => {
  return post<number[], null>("/api/clothes/deleteAll", data);
};
